<template>
  <div class="position-box">
      <div class="choose">
          <span>你已选择：{{chooseCity}}</span>
      </div>
      <div class="history">
          <p>定位/最近访问</p>
          <div class="citybox">
              <button @click="changeCity(orientate)">
                  <i class="iconfont icon-dingwei icon"></i>{{orientate}}
              </button>
              <button @click="changeCity(item)" v-for="item in historyCityArr" :key="item">{{item}}</button>
          </div>
      </div>
      <div class="hot">
          <p>热门城市</p>
          <div class="citybox">
              <button v-for="city in hotCitys" :key="city" @click="changeCity(city)">{{city}}</button>
          </div>
      </div>
  </div>
</template>

<script>
    export default {
        name:"PositionBox",
        props:{
            chooseCity:{
                type:String,
                default:''
            },
            historyCityArr:Array,
            orientate:{
                type:String,
                default:''
            }
        },
        data(){
            return{
                hotCitys:['北京', '上海', '广州', '深圳', '天津', '西安', '重庆', '杭州', '南京']
            }
        },
        methods:{
            changeCity(name){
                this.$emit('changeCity',name)
            }
        }
    }
</script>

<style lang="scss" scoped>
    @import 'PositionBox.scss';
</style>
